package com.ly.core.service;

import java.io.Serializable;
import java.util.List;

import com.ly.core.command.QueryFilter;
import com.ly.core.web.paging.PagingBean;

/**
 * 
 * @author csx
 * 
 * @param <T>
 * @param <PK>
 */
public interface GenericService<T, PK extends Serializable> {
	/**
	 * 
	 * @param entity
	 * @return
	 */
	public T save(T entity);

	/**
	 * merge the object
	 * 
	 * @param entity
	 * @return
	 */
	public T merge(T entity);

	/**
	 * evict the object
	 * 
	 * @param entity
	 */
	public void evict(T entity);

	/**
	 * 
	 * @param id
	 * @return
	 */
	public T get(PK id);

	/**
	 * 
	 * @return
	 */
	public List<T> getAll();

	/**
	 * 
	 * @param pb
	 * @return
	 */
	public List<T> getAll(PagingBean pb);

	/**
	 * 
	 * @param filter
	 * @return
	 */
	public List<T> getAll(QueryFilter filter);

	public void remove(PK id);

	public void removeObj(Serializable ids);

	public void removeObjs(List<Serializable> ids);
}
